//
//  GMHAcitvityTableViewCell.m
//  
//
//  Created by 郭明皓 on 15/10/22.
//
//

#import "GMHAcitvityTableViewCell.h"
#import "DKNightVersion.h"
@implementation GMHAcitvityTableViewCell
#define WIDTH self.backgroundViews.frame.size.width
#define HEIGHT self.backgroundViews.frame.size.height

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}

- (void)dealloc
{
    [_title release];
    [_leftimageView release];
    [_backgroundViews release];
    [_username release];
    [_viewImage release];
    [_replys release];
    [_replysImage release];
    [_viewImage release];
    [_views release];
    [super dealloc];
}
- (void)create
{
    [DKNightVersionManager addClassToSet:self.class];
    self.nightBackgroundColor = UIColorFromRGB(0x343434);
    
    
    self.backgroundViews = [[UIView alloc]init];
    [self.contentView addSubview:self.backgroundViews];
    [self.backgroundViews release];
    
    self.leftimageView = [[UIImageView alloc]init];
    [self.backgroundViews addSubview:self.leftimageView];
    [self.leftimageView release];
    
    self.title = [[UILabel alloc]init];
    [self.backgroundViews addSubview:self.title];
    [self.title release];
    self.title.numberOfLines = 2;
    self.title.textColor = [UIColor darkGrayColor];
    self.title.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
    
    
    self.username = [[UILabel alloc]init];
    [self.backgroundViews addSubview:self.username];
    [self.username release];
    self.username.font = [UIFont systemFontOfSize:12];
    self.username.textColor = [UIColor darkGrayColor];
    
    self.viewImage = [[UIImageView alloc]init];
    [self.backgroundViews addSubview:self.viewImage];
    [self.viewImage release];
    
    self.views = [[UILabel alloc]init];
    [self.backgroundViews addSubview:self.views];
    [self.views release];
    self.views.font = [UIFont systemFontOfSize:12];
//    self.views.textColor = [UIColor darkGrayColor];
    
    self.replysImage = [[UIImageView alloc]init];
    [self.backgroundViews  addSubview:self.replysImage];
    [self.replysImage release];
    
    
    self.replys = [[UILabel alloc]init];
    [self.backgroundViews addSubview:self.replys];
    [self.replys release];
    self.replys.font = [UIFont systemFontOfSize:12];
//    self.replys.textColor = [UIColor darkGrayColor];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.backgroundViews.frame = CGRectMake(5, 5, self.contentView.frame.size.width - 10, self.frame.size.height - 10);
    self.leftimageView.frame = CGRectMake(0, 0, WIDTH / 3, HEIGHT);
    self.title.frame = CGRectMake(WIDTH / 3 + 10, 0, WIDTH / 3 * 2 - 10, HEIGHT / 2);
    self.username.frame = CGRectMake(WIDTH / 3 + 10, HEIGHT / 2, WIDTH / 3 * 2 - 10, HEIGHT / 4);
    self.viewImage.frame = CGRectMake(WIDTH / 3 + 10, HEIGHT / 4 * 3 + 3, 20, HEIGHT / 4 - 5);
    self.views.frame = CGRectMake(WIDTH / 3 + 40, HEIGHT / 4 * 3, 60, HEIGHT / 4);
    self.replysImage.frame = CGRectMake(WIDTH / 3 + 100, HEIGHT / 4 * 3 + 3, 20, HEIGHT / 4 - 5);
    self.replys.frame = CGRectMake(WIDTH / 3 + 130, HEIGHT / 4 * 3, 60, HEIGHT / 4);
}
@end
